%
% 
clear all
close all


 disp('Caesarean Section Example')
  lw = 3; 
  set(0, 'DefaultAxesFontSize', 16);
  fs = 15;
  msize = 10;
  


infection = [1 11 0 0 28 23 8 0];
total = [18 98 2 0 58 26 40 9];
proportion = infection./total;
noplan = [0 1 0 1 0 1 0 1];
riskfact = [1 1 0 0 1 1 0 0];
antibio = [1 1 1 1 0 0 0 0];
[logitCoef2,dev2] = glmfit([noplan' riskfact' antibio'],[infection' total'],'binomial','logit');
logitFit = glmval(logitCoef2,[noplan' riskfact' antibio'],'logit');

figure(1)
plot(1:8, proportion,'ks',  'markersize', msize)
hold on
plot(1:8, logitFit,'ko', 'markersize', msize );
plot(1:8, logitFit,'k:', 'linewidth', lw );
axis tight
print -deps 'C:\NPBook\NPRegression\caesarean.eps'